-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] include/exclude filters (#1) #2
Conversation
* First commit with include/exclude filters * Enable manual workflow runs * Updated index.js * add an action run with filters * required include * negative lookup * updated index.js * updated package.json * new regex test * updated workflow * rollback packages update * change the invert match logic * fix regex * testing dummy files * better assignment * remove dummy test files * original packages.json * fix yarn issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well done!
@micalevisk @Ana06 do you think we should already merge this as is and review the suggestion on the issue #1 first or rework this completely? |
I like that suggestion because it seems like more idiomatic to GH Actions with:
paths:
- '*.yml'
- '!blah/test/**' To implement this, I'd say is better to open a new PR and close this one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work @rnsc! Thank you so much for sending a PR ❤️ and sorry for the late review, busy week! 😅
Some documentation about this great new features on the README would be nice 😉
Thanks @micalevisk for reviewing the PR and for sharing your opinion! 😄
I really do not have an strong opinion about what option we should take (GH Actions like vs include/exclude). As already two persons mentioned they prefer the GH Actions like syntax I tend to think we should use that one. @rnsc do you want to work on that or do you prefer we merge this (maybe after addressing the minor changes and adding documentation if you have time) and then someone else sends a PR for the GH Actions like implementation?
|
||
- name: Print steps context output | ||
- name: Print files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] I think the name was accurate, but it is not very important. Does someone else has an opinion about this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to have a different name since I had duplicated the step with the exclude filter.
Hey @Ana06 Thank you for taking the time to review this, don't feel pressured to do so if you have other stuff on your hands though, I was merely mentioning you for visibility regarding the feedback I had received on the issue for the feature request itself! Adding @agraul @micalevisk too for the following inquiry: I'll check if I can do something about accepting a list of containing both include and exclude like suggested in this example: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#example-using-positive-and-negative-patterns-1 The paths definition for files is not a regex but a glob pattern though. |
I think it is since it follows the filter pattern cheat sheet (you could add this cheat sheet to the README) |
Isn't that already the case? Looking at the README and the current code, the default filter is
I'm no expert, from a first glance it looks like it should work. |
Support for glob filtering with multi-rules.
Hello @Ana06 @micalevisk @agraul , I believe I have the correct logic in place to support glob filtering. Thank you for your time and feedback on this. |
@@ -1,16 +1,18 @@ | |||
# get-changed-files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did a bit of linting on the README too, I hope that's ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's awesome, thanks!
README.md
Outdated
@@ -22,16 +24,23 @@ See [action.yml](action.yml) | |||
# Default: 'space-delimited' | |||
format: '' | |||
# Filter files using a regex | |||
filter: '*' | |||
glob-filter: '*' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, the verison of the action should be changed too right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it should. yarn version --no-git-tag-version --major
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
right, @micalevisk, @Ana06, should we also change the repository URLs in the package.json? Or are we planning on trying to merge in the original repo in the future?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did the yarn command thingie, I'll let you all check :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we call it grob-filter
or just filter? I like filter
, as we don't have any other filer I think the name doesn't need to be more specific as long as we document it properly. But I don't have a strong opinion... 🤔 🤔 Any other opinion?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we also change the repository URLs in the package.json? Or are we planning on trying to merge in the original repo in the future?
I think we can change the urls. I was hopping upstream integrates these changes when I originally forked it, but it doesn't look like it will happen.
@@ -39,7 +39,7 @@ | |||
"all": "yarn clean && yarn build && yarn format && yarn lint && yarn package && yarn test" | |||
}, | |||
"dependencies": { | |||
"@actions/core": "^1.2.2", | |||
"@actions/core": "^1.4.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I bumped it to a more recent version to have getMultilineInput
support.
format: '' | ||
# Filter files using a regex | ||
glob-filter: | | ||
*.yml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@agraul not sure if you've seen this, but as GitHub actions core doesn't support a standard YAML as input, we have to declare the list a multi line string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the ping, I missed that. It's a bit unfortunate, I didn't know that lists can't be passed, but as long as the structure is kept I think this is still nice!
Hello @Ana06 Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work! Just some minor comments. Once those are addressed/discussed, let's merge this and I can release version 2.0 🎉
@@ -1,16 +1,18 @@ | |||
# get-changed-files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's awesome, thanks!
README.md
Outdated
@@ -22,16 +24,23 @@ See [action.yml](action.yml) | |||
# Default: 'space-delimited' | |||
format: '' | |||
# Filter files using a regex | |||
filter: '*' | |||
glob-filter: '*' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we call it grob-filter
or just filter? I like filter
, as we don't have any other filer I think the name doesn't need to be more specific as long as we document it properly. But I don't have a strong opinion... 🤔 🤔 Any other opinion?
|
||
## Get all changed files as space-delimited | ||
### Get all changed files as space-delimited |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know this was already like this before, but I think it would be clearer to have this Get all changed files as space-delimited
without the filter option and make another section to only get *.php
and give there some more details about how the filter option works (that a list of regular expression is expected, GitHub like syntax is used, etc.). Ideally users should be able to understand how it works only with the README without checking the code. I am not completely sure this is the case now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added one example
README.md
Outdated
@@ -22,16 +24,23 @@ See [action.yml](action.yml) | |||
# Default: 'space-delimited' | |||
format: '' | |||
# Filter files using a regex | |||
filter: '*' | |||
glob-filter: '*' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we also change the repository URLs in the package.json? Or are we planning on trying to merge in the original repo in the future?
I think we can change the urls. I was hopping upstream integrates these changes when I originally forked it, but it doesn't look like it will happen.
b05c075
to
068f1f4
Compare
Hello @Ana06 , I think I have made all the changes required, what would be the next steps? Not sure if can help still! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job @rnsc and sorry for the late response. I think it is ready to merge 🎉
[Feature] include/exclude filters (#1)
There as a discussion on the name to use in #2 and we forgot to change these.
@@ -85,12 +85,37 @@ jobs: | |||
- id: files | |||
name: Run the action | |||
uses: ./ | |||
with: | |||
glob-filter: '*' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had skipped that one 🙈 I have fix it on main 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh no! Sorry!
Hello @Ana06 ,
Here's my attempt at the include/exclude filtering following issue #1.
I've picked up the suggestion regarding the use of regex from @micalevisk.
Disclaimer, I'm no programmer, so I hope I haven't made any terrible mistakes.